package edu.hawaii.ics499;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
  
  private final static int DB_VERSION = 7;
  private final static String DB_NAME = "SensorTest"; 

  public DatabaseHelper(Context context) {
    super(context, DB_NAME, null, DB_VERSION);
      
  }

  @Override
  public void onCreate(SQLiteDatabase db) {
    String sql = "CREATE TABLE accelerometer (" +
    		"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
    		"data INTEGER NOT NULL," +
    		"timestamp TEXT NOT NULL" +
    		")";
    db.execSQL(sql);
    
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS accelerometer");
    onCreate (db);
    
  }

}
